import moduleRegist from '@/utils/moduleRegist';
import { module as AwaitBillModule } from './Module/awaitBillModule';
import { module as awaitaBillAbnormalModule } from './Module/awaitaBillAbnormalModule';
import { module as awaitBillClearingModule } from './Module/awaitBillClearingModule';
import { module as SucceedBillModule } from './Module/succeedBillModule';
import { module as BankBillCountModule } from './Module/bankBillCountModule';
import { module as BankBillDetailModule } from './Module/bankBillDetailModule';
import { module as UnionPayBillModule } from './Module/unionPayBillModule';

const Layout = resolve => { require(['./Layout'], resolve); };
const AwaitBill = resolve => { require(['./AwaitBill'], resolve); };
const AwaitBillDetele = resolve => { require(['./AwaitBillDetele'], resolve); };
const AwaitBillUnusualDetele = resolve => { require(['./AwaitBillUnusualDetele'], resolve); };
const AwaitBillBatchProces = resolve => { require(['./AwaitBillBatchProces'], resolve); };
const SucceedBill = resolve => { require(['./SucceedBill'], resolve); };
const SucceedBillDetele = resolve => { require(['./SucceedBillDetele'], resolve); };
const BankBill = resolve => { require(['./BankBill'], resolve); };
const UnionPayBill = resolve => { require(['./UnionPayBill'], resolve); };
const CouponBill = resolve => { require(['./CouponBill'], resolve); };

export default [
    /** 配置管理路由 */
    {
        path: 'billCenter',
        redirect: 'billCenter/awaitBill',
        component: Layout,
        meta: {
            title: '账单中心',
            name: '账单中心',
            permission: 'trade:settlement:bill',
            componentName: 'ConfigpayerLayout',
            keepAlive: true,
            icon: '',
            show: false
        },
        beforeEnter: (to, from, next) => {
            moduleRegist(AwaitBillModule);
            moduleRegist(awaitaBillAbnormalModule);
            moduleRegist(awaitBillClearingModule);
            moduleRegist(SucceedBillModule);
            moduleRegist(BankBillCountModule);
            moduleRegist(BankBillDetailModule);
            moduleRegist(UnionPayBillModule);
            next();
        },
        children: [{
                path: 'awaitBill',
                component: AwaitBill,
                meta: {
                    title: '清分待对账单',
                    name: '清分待对账单',
                    breadcrumb: '清分待对账单',
                    permission: 'trade:settlement:unReconciled',
                    keepAlive: true,
                    show: true,
                    componentName: 'ConfigpayerListView',
                    icon: ''
                }
            },
            {
                path: 'awaitBillDetele',
                component: AwaitBillDetele,
                meta: {
                    title: '清分待对账单详情',
                    name: '清分待对账单详情',
                    breadcrumb: '清分待对账单详情',
                    permission: 'trade:settlement:unReconciled',
                    keepAlive: true,
                    show: false,
                    componentName: 'ConfigpayerListView',
                    icon: ''
                }
            },
            {
                path: 'awaitBillUnusualDetele',
                component: AwaitBillUnusualDetele,
                meta: {
                    title: '待对账异常单详情',
                    name: '待对账异常单详情',
                    breadcrumb: '待对账异常单详情',
                    permission: 'trade:settlement:unReconciled',
                    keepAlive: true,
                    show: false,
                    componentName: 'ConfigpayerListView',
                    icon: ''
                }
            },
            {
                path: 'awaitBillBatchProces',
                component: AwaitBillBatchProces,
                meta: {
                    title: '待对账异常单详情',
                    name: '待对账异常单详情',
                    breadcrumb: '待对账异常单详情',
                    permission: 'trade:settlement:unReconciled',
                    keepAlive: true,
                    show: false,
                    componentName: 'ConfigpayerListView',
                    icon: ''
                }
            },
            {
                path: 'succeedBill',
                component: SucceedBill,
                meta: {
                    title: '成功对账单',
                    name: '成功对账单',
                    breadcrumb: '成功对账单',
                    permission: 'trade:settlement:cmb',
                    keepAlive: true,
                    show: true,
                    componentName: 'ConfigpayerListView',
                    icon: ''
                }
            },
            {
                path: 'succeedBillDetele',
                component: SucceedBillDetele,
                meta: {
                    title: '成功对账单详情',
                    name: '成功对账单详情',
                    breadcrumb: '成功对账单详情',
                    permission: 'trade:settlement:cmb',
                    keepAlive: true,
                    show: false,
                    componentName: 'ConfigpayerListView',
                    icon: ''
                }
            },
            {
                path: 'BankBill',
                component: BankBill,
                meta: {
                    title: '银行对账单',
                    name: '银行对账单',
                    breadcrumb: '银行对账单',
                    permission: 'trade:settlement:bill:BankBill',
                    keepAlive: true,
                    show: true,
                    componentName: 'ConfigpayerListView',
                    icon: ''
                }
            },
            {
                path: 'UnionPayBill',
                component: UnionPayBill,
                meta: {
                    title: '银联对账单',
                    name: '银联对账单',
                    breadcrumb: '银联对账单',
                    permission: 'trade:settlement:bill:UnionPayBill',
                    keepAlive: true,
                    show: true,
                    componentName: 'ConfigpayerListView',
                    icon: ''
                }
            },
            {
                path: 'CouponBill',
                component: CouponBill,
                meta: {
                    title: '优惠券账单',
                    name: '优惠券账单',
                    breadcrumb: '优惠券账单',
                    permission: 'trade:settlement:bill:CouponBill',
                    keepAlive: true,
                    show: true,
                    componentName: 'CouponBillListView',
                    icon: ''
                }
            }
        ]
    }
];